#include <iostream>
#include <vector>
using namespace std;

class Solution {
public:
    int minCostClimbingStairs(vector<int>& cost) {
        size_t size = cost.size();
        vector<int> dp;
        dp.resize(size);
        dp[0] = dp[1] = 0;

        for (size_t i = 2; i < dp.size(); ++i)
        {
            dp[i] = (int)fmin(dp[i - 1] + cost[i - 1], dp[i - 2] + cost[i - 2]);
        }
        return (int)fmin(dp[size - 1] + cost[size - 1], dp[size - 2] + cost[size - 2]);
    }
};

//10 1 10 10 1 1 1 1
//1 10 10 1 1
//1 1 10 10 1
//1 1 10 1
//1 1 1 

int main() {
    /*vector<int> nums;
    nums.push_back(2); nums.push_back(5); nums.push_back(20);
    cout << *nums.begin() << endl;
    cout << *(nums.end() - 1) << endl;
    cout << *nums.rbegin() << endl;
    cout << *(nums.rend() - 1) << endl;
    cout << (nums.rbegin() < nums.rend()) << endl;*/
    return 0;
}


